package org.realogic.cfm.domain;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;

public class KQueryParamters implements Serializable {

	private static final long serialVersionUID = -3793054120030484709L;

	// 租户ID
	private String tenantId;

	// 查询名称
	private String queryName;

	// 查询的页数
	private int pageNumber = 1;

	// 页面留览的大小
	private int pageSize = -1;

	private Map<String, String> paramMap;

	private int initialCapacity = 30;

	public KQueryParamters(int initialCapacity) {
		this.initialCapacity = initialCapacity;
	}

	public KQueryParamters() {

	}

	public String getQueryName() {
		return queryName;
	}

	public void setQueryName(String queryName) {
		this.queryName = queryName;
	}

	private Map<String, String> getSafeParamMap() {
		if (paramMap == null) {
			int x = initialCapacity > 0 ? initialCapacity : 30;
			paramMap = new LinkedHashMap<String, String>(x);
		}
		return paramMap;

	}

	public String getTenantId() {
		return tenantId;
	}

	public void setTenantId(String tenantId) {
		this.tenantId = tenantId;
	}

	public Map<String, String> getParamMap() {
		return getSafeParamMap();
	}

	public int getPageNumber() {
		return pageNumber;
	}

	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void add(String key, String value) {
		this.getSafeParamMap().put(key, value);
	}

	public String getStringValue(String key) {
		return getSafeParamMap().get(key);
	}

}
